.ast-tree-macos {
  display: flex;
  flex-direction: row;
  gap: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #ffffff;
  height: 100vh;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
}

.tree-root {
  list-style: none;
  padding-left: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.tree-node {
  padding-left: 0.5rem;
  margin-bottom: 2px;
}

.tree-node ul {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  transform-origin: top;
}

.tree-node ul:not([style*="display: none"]) {
  animation: expand-node 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes expand-node {
  from {
    opacity: 0;
    transform: scaleY(0.95);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.node-row {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 6px;
  transition: all 0.15s ease;
  position: relative;
  min-height: 28px;
  margin: 1px 8px;
}

.node-row:hover {
  background: rgba(0, 122, 255, 0.08);
}

.tree-node.selected>.node-row {
  background: rgba(0, 122, 255, 0.12);
  color: #007aff;
  animation: highlight-selection 0.3s ease-in-out;
}

@keyframes highlight-selection {
  0% {
    background: rgba(0, 122, 255, 0.3);
    transform: scale(1.02);
  }

  100% {
    background: rgba(0, 122, 255, 0.12);
    transform: scale(1);
  }
}

/* 滚动高亮效果 */
.scroll-highlight .node-row {
  background: rgba(255, 204, 0, 0.2) !important;
  border: 2px solid rgba(255, 204, 0, 0.6) !important;
  animation: scroll-highlight-pulse 2s ease-in-out;
}

@keyframes scroll-highlight-pulse {

  0%,
  100% {
    background: rgba(255, 204, 0, 0.2);
    border-color: rgba(255, 204, 0, 0.6);
  }

  50% {
    background: rgba(255, 204, 0, 0.4);
    border-color: rgba(255, 204, 0, 0.8);
  }
}

.toggle-btn {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #8a8a99;
  margin-right: 6px;
  user-select: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.toggle-btn span {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn:hover span {
  transform: scale(1.2);
}

.toggle-btn:hover {
  color: #007aff;
}

.node-type {
  font-weight: 500;
  color: #1d1d1f;
  margin-right: 8px;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.node-label {
  color: #86868b;
  font-size: 12px;
  font-style: normal;
}

ul {
  list-style: none;
  padding-left: 1.3em;
  margin: 0;
}

.node-detail {
  min-width: 340px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
  font-size: 14px;
  color: #1d1d1f;
  word-break: break-all;
  border: 1px solid #e1e5e9;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: detail-slide-in 0.3s ease-out;
}

@keyframes detail-slide-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.node-detail h3 {
  margin-top: 0;
  font-size: 1.15em;
  font-weight: 700;
  color: #007aff;
  letter-spacing: 0.01em;
}

pre {
  background: #f4f5fa;
  border-radius: 10px;
  padding: 0.7em 1.2em;
  font-size: 13px;
  overflow-x: auto;
  border: 1px solid #e0e0e6;
  margin: 0;
}

/* 滚动条美化 */
.tree-root,
.node-detail pre {
  scrollbar-width: thin;
  scrollbar-color: #cfd8dc #f4f5fa;
}

.tree-root::-webkit-scrollbar,
.node-detail pre::-webkit-scrollbar {
  width: 7px;
  background: #f4f5fa;
}

.tree-root::-webkit-scrollbar-thumb,
.node-detail pre::-webkit-scrollbar-thumb {
  background: #cfd8dc;
  border-radius: 6px;
}

.node-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  margin-bottom: 0;
}

.node-table td {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  animation: table-row-fade-in 0.3s ease-out;
  animation-fill-mode: both;
}

.node-table tr:nth-child(1) td {
  animation-delay: 0.1s;
}

.node-table tr:nth-child(2) td {
  animation-delay: 0.2s;
}

.node-table tr:nth-child(3) td {
  animation-delay: 0.3s;
}

.node-table tr:nth-child(4) td {
  animation-delay: 0.4s;
}

.node-table tr:nth-child(5) td {
  animation-delay: 0.5s;
}

.node-table tr:nth-child(6) td {
  animation-delay: 0.6s;
}

@keyframes table-row-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.node-table tr td:first-child {
  color: #86868b;
  font-weight: 500;
  background: #f5f5f7;
  min-width: 80px;
  text-align: right;
  font-size: 12px;
}

.node-table tr td:last-child {
  color: #1d1d1f;
  background: #f8f9fa;
  word-break: break-all;
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
}

.node-table a {
  color: #007aff;
  text-decoration: underline;
  word-break: break-all;
}

.ast-tree-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 0;
  overflow: hidden;
}

/* macOS风格标题栏 */
.macos-titlebar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  background: #f5f5f7;
  border-bottom: 1px solid #e1e5e9;
  padding: 0 12px;
  flex-shrink: 0;
  -webkit-app-region: drag;
  position: relative;
}

.titlebar-buttons {
  display: flex;
  gap: 8px;
  -webkit-app-region: no-drag;
  position: absolute;
  left: 12px;
}

.titlebar-button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s;
}

.titlebar-button:hover {
  opacity: 0.8;
}

.titlebar-button.close {
  background: #ff5f57;
}

.titlebar-button.minimize {
  background: #febc2e;
}

.titlebar-button.maximize {
  background: #28c840;
}

.titlebar-title {
  font-size: 12px;
  font-weight: 500;
  color: #86868b;
  -webkit-app-region: no-drag;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.titlebar-icon {
  font-size: 14px;
  animation: tree-grow 3s ease-in-out infinite;
  display: inline-block;
}

@keyframes tree-grow {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  25% {
    transform: scale(1.1) rotate(5deg);
  }

  50% {
    transform: scale(1.05) rotate(-3deg);
  }

  75% {
    transform: scale(1.15) rotate(2deg);
  }
}

.markdown-raw {
  padding: 12px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
  font-size: 13px;
  max-height: 180px;
  overflow: hidden;
  flex-shrink: 0;
  border-top: 1px solid #e1e5e9;
  position: relative;
}

.markdown-raw pre {
  margin: 0;
  padding: 0;
  text-indent: 0;
}

/* 交互式markdown样式 */
.interactive-markdown {
  cursor: pointer;
  user-select: text;
  transition: background-color 0.2s ease;
  border: 2px solid transparent;
  border-radius: 4px;
}

.interactive-markdown:hover {
  background-color: rgba(0, 122, 255, 0.05);
  border-color: rgba(0, 122, 255, 0.2);
}

/* 右键菜单样式 */
.context-menu {
  position: fixed;
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  z-index: 1000;
  min-width: 160px;
  font-size: 13px;
  color: #1d1d1f;
  animation: context-menu-pop 0.2s ease-out;
  transform-origin: top left;
}

@keyframes context-menu-pop {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  gap: 8px;
}

.context-menu-item:hover {
  background-color: rgba(0, 122, 255, 0.1);
}

.context-menu-item:first-child {
  border-radius: 8px 8px 0 0;
}

.context-menu-item:last-child {
  border-radius: 0 0 8px 8px;
}

.menu-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

/* 面包屑导航样式 */
.breadcrumb-container {
  padding: 8px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
  flex-shrink: 0;
  animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #86868b;
  overflow-x: auto;
  white-space: nowrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  border: 1px solid rgba(0, 122, 255, 0.2);
  animation: breadcrumb-fade-in 0.2s ease-out;
  animation-fill-mode: both;
}

@keyframes breadcrumb-fade-in {
  from {
    opacity: 0;
    transform: translateX(-3px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.breadcrumb-item:hover {
  background: rgba(0, 122, 255, 0.15);
  color: #0056cc;
}

.breadcrumb-item.active {
  background: rgba(0, 122, 255, 0.2);
  color: #0056cc;
  font-weight: 600;
}

.breadcrumb-content {
  color: #1d1d1f;
  font-weight: normal;
}

.breadcrumb-icon {
  font-size: 10px;
  margin-right: 4px;
  opacity: 0.7;
}

.breadcrumb-separator {
  color: #86868b;
  font-weight: 600;
  margin: 0 2px;
  animation: separator-fade-in 0.15s ease-out;
  animation-fill-mode: both;
}

@keyframes separator-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.breadcrumb-clear-btn {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: #ff3b30;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.breadcrumb-clear-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.5);
  color: #d70015;
}

.markdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
}

.debug-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #86868b;
  background: rgba(0, 122, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.debug-label {
  font-weight: 500;
}

.debug-offset {
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 10px;
}

.debug-placeholder {
  width: 80px;
  height: 20px;
  opacity: 0;
}

.clear-selection-btn {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: #ff3b30;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-selection-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.5);
  color: #d70015;
}

.markdown-title {
  font-weight: 600;
  color: #1d1d1f;
  font-size: 13px;
}

.markdown-hint {
  color: #86868b;
  font-size: 11px;
  font-style: normal;
}

.markdown-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 11px;
  background: none;
  line-height: 1.4;
  max-height: 140px;
  overflow-y: auto;
  color: #1d1d1f;
  padding: 8px;
  text-indent: 0;
  border-radius: 4px;
  transition: all 0.2s ease;
  animation: content-fade-in 0.5s ease-out;
}

@keyframes content-fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ast-tree-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.ast-tree-left {
  width: 320px;
  min-width: 280px;
  max-width: 400px;
  border-right: 1px solid #e1e5e9;
  overflow-y: auto;
  padding: 16px 0;
  background: #f8f9fa;
  flex-shrink: 0;
}

.ast-tree-right {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  background: #ffffff;
  min-width: 0;
}

.node-detail {
  background: #f9f9f9;
  border-radius: 6px;
  padding: 18px 20px 12px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.markdown-raw mark {
  background: rgba(0, 122, 255, 0.15);
  color: #007aff;
  border-radius: 3px;
  padding: 1px 3px;
  font-weight: 500;
}